package com.lee.dutylower;

import android.content.Context;
import android.os.Environment;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import com.lee.dutylower.db.greendao.PostRecordDao;
import com.lee.dutylower.utils.ExcelUtil;
import com.lee.dutylower.utils.LogUtils;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
 * Instrumentation test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @Test
    public void useAppContext() throws Exception {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getTargetContext();

        assertEquals("com.lee.dutylower", appContext.getPackageName());
    }
    @Test
    public void createXls() throws Exception {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getTargetContext();
        PostRecordDao prd = MyApplication.getApplication().getDaoSession().getPostRecordDao();
        ExcelUtil.UpdateExcelByTemplate(appContext,prd,2);
    }

    @Test
    public void testFilePath() throws Exception {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getTargetContext();
        String p = Environment.getExternalStorageDirectory().getAbsolutePath();
        LogUtils.e("dutylower",p);
    }
}
